package cn.yangliu.webflux;

import cn.yangliu.webflux.config.MyHandlerResultHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.http.codec.ServerCodecConfigurer;
import org.springframework.web.reactive.accept.RequestedContentTypeResolver;

@SpringBootApplication
public class WebfluxApplication {

    @Autowired
    ServerCodecConfigurer serverCodecConfigurer;
    @Autowired
    RequestedContentTypeResolver requestedContentTypeResolver;

    @Bean
    public MyHandlerResultHandler handlerResultHandler(){
        return new MyHandlerResultHandler(serverCodecConfigurer.getWriters(), requestedContentTypeResolver);
    }
    public static void main(String[] args) {
        SpringApplication.run(WebfluxApplication.class, args);
    }

}
